package org.dmcs.linguistics.labs.nfa.states;

/**
 * The set of states of the file parsing NFA.
 * @author Zielony
 * @version 1.0
 */
public enum NFAState {
	
	INITIAL(null, false),
	S01(0, false),
	S02(0, false),
	S11(1, false),
	S12(1, false),
	S21(2, false),
	S22(2, false),
	S31(3, false),
	S32(3, false),
	S41(4, false),
	S42(4, false),
	S51(5, false),
	S52(5, false),
	S61(6, false),
	S62(6, false),
	S71(7, false),
	S72(7, false),
	S81(8, false),
	S82(8, false),
	S91(9, false),
	S92(9, false),
	FINAL(null, true);
	
	/**
	 * A symbol whose repetition corresponds to this state.
	 */
	private Integer repeatedSymbol;
	
	/**
	 * A flag determining if the state is accepting.
	 */
	private boolean accepting;
	
	/**
	 * Creates a new state basing the symbol that was repeated and whether the state is accepting or not.
	 * @param repeatedSymbol the symbol that was repeated.
	 * @param accepting whether the state is accepting or not.
	 */
	NFAState(Integer repeatedSymbol, boolean accepting) {
		this.repeatedSymbol = repeatedSymbol;
		this.accepting = accepting;
	}
	
	/**
	 * Gets: the symbol that was repeated.
	 * @return the symbol that was repeated.
	 */
	public Integer getRepeatedSymbol() {
		return repeatedSymbol;
	}
	
	/**
	 * Determines whether the state is accepting or not.
	 * @return <code>true</code> if the state is accepting, <code>false</code> otherwise.
	 */
	public boolean isAccepting() {
		return accepting;
	}
}